﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PayMonthBlance.aspx.cs" Inherits="PayMonthBlance" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>财务月结</title>
    <script src="../js/extTools.js" type="text/javascript"></script>
    <style>
        .x-grid-row-over .x-grid-cell-inner
        {
            font-weight: bold;
        }
        .x-column-header-inner
        {
            height: 28px;
            background: #E7EBEF url(./images/header.png) repeat-x 0 0;
        }
        .child-row .x-grid-cell
        {
            color: red;
        }
        .adult-row .x-grid-cell
        {
            background-color: #ffffff;
            color: green;
        }
    </style>
    <script>
        var getRowClass = function (record, rowIndex, rowParams, store) {
            var css = "adult-row"
            if (record.data.财务确认 == '已确认') {
                css = 'cw-row'
            }
            if (record.data.客户确认 == '已确认') {
                css = 'child-row'
            }
            return css;
            //return record.data.财务确认 == '已确认' ? 'child-row' : 'adult-row';
        };
        var template = '<span style="color:#fff;background-color:{0};padding: 5px 10px;">{1}</span>';
        var changesate = function (value) {
            return Ext.String.format(template, (value == '未确认') ? "green" : "red", value);
        };
        var prepare = function (grid, toolbar, rowIndex, record) {
            var firstButton = toolbar.items.get(0);

            if (record.data.财务确认 == '已确认') {
                firstButton.setDisabled(true);
                //firstButton.setTooltip("Disabled");
            }

            //you can return false to cancel toolbar for this record
        };
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <ext:ResourceManager ID="ResourceManager1" runat="server" Theme="Crisp" />
        <ext:Viewport ID="Viewport1" runat="server" Layout="FitLayout">
            <Items>
                <ext:Hidden ID="FormatType" runat="server" />
                <ext:Hidden ID="Hidden1" runat="server" />
                <ext:GridPanel ID="GridPanel1" runat="server" TitleAlign="Center">
                    <TopBar>
                        <ext:Toolbar ID="Toolbar1" runat="server" Layout="ColumnLayout">
                            <Items>
                                <ext:DateField runat="server" ID="txtmonth" FieldLabel="所属月份" EmptyText="所属月份" Type="Month"
                                    Format="yyyy-MM" />
                                <ext:TextField runat="server" ID="txtshop" EmptyText="输入店铺编号/名称" />
                                <ext:Button ID="Button1" runat="server" Text="查询" OnDirectClick="BtnQureyUser" UI="Info"
                                    Icon="Find">
                                    <DirectEvents>
                                        <Click>
                                            <EventMask ShowMask="true" Msg="加载中...">
                                            </EventMask>
                                        </Click>
                                    </DirectEvents>
                                </ext:Button>
                                <ext:Component runat="server" Width="1500" Margin="3" />
                                <ext:Button ID="Button4" runat="server" Text="删除" OnDirectClick="BtnDeletData" UI="Danger"
                                    Icon="Delete" />
                            </Items>
                        </ext:Toolbar>
                    </TopBar>
                    <Store>
                        <ext:Store ID="Store1" runat="server" PageSize="100" OnReadData="RefreshDataSet"
                            OnSubmitData="Store1_Submit">
                            <Model>
                                <ext:Model ID="Model1" runat="server">
                                    <Fields>
                                        <ext:ModelField ServerMapping="ShopCode" Name="店铺代码" />
                                        <ext:ModelField ServerMapping="ShopName" Name="店铺简称" />
                                        <ext:ModelField ServerMapping="paydate" Name="结算日期" />
                                        <ext:ModelField ServerMapping="paymoney" Name="营业额合计" />
                                        <ext:ModelField ServerMapping="fctot" Name="分成合计" />
                                        <ext:ModelField ServerMapping="fyamt" Name="预扣费用" />
                                        <ext:ModelField ServerMapping="sjpay" Name="存至客户卡现金" />
                                        <ext:ModelField ServerMapping="sjfy" Name="本月费用" />
                                        <ext:ModelField ServerMapping="endamount" Name="月结金额" />
                                        <ext:ModelField ServerMapping="cwstate" Name="财务确认" />
                                        <ext:ModelField ServerMapping="clstate" Name="客户确认" />
                                    </Fields>
                                </ext:Model>
                            </Model>
                        </ext:Store>
                    </Store>
                    <ColumnModel>
                        <Columns>
                        <ext:RowNumbererColumn ID="RowNumbererColumn1" runat="server" Width="65" Header="序号" Text="序号" />
                            <ext:Column ID="Column10" runat="server" Text="店铺代码" DataIndex="店铺代码" Width="80" />
                            <ext:Column ID="Column11" runat="server" Text="店铺简称" DataIndex="店铺简称" Width="150" />
                            <ext:Column ID="Column12" runat="server" Text="结算日期" DataIndex="结算日期" Width="80" />
                            <ext:Column ID="Column13" runat="server" Text="营业额合计" DataIndex="营业额合计" Width="100" />
                            <ext:Column ID="Column14" runat="server" Text="分成合计" DataIndex="分成合计" Width="80" />
                            <ext:Column ID="Column15" runat="server" Text="预扣费用" DataIndex="预扣费用" Width="80" />
                            <ext:Column ID="Column16" runat="server" Text="存至客户卡现金" DataIndex="存至客户卡现金" Width="120" />
                            <ext:Column ID="Column9" runat="server" Text="本月费用" DataIndex="本月费用" Width="80" />
                            <ext:Column ID="Column17" runat="server" Text="月结金额" DataIndex="月结金额" Width="100" />
                            <ext:Column ID="Column18" runat="server" Text="财务确认" DataIndex="财务确认" Width="100">
                                <Renderer Fn="changesate" />
                            </ext:Column>
                            <ext:Column ID="Column19" runat="server" Text="客户确认" DataIndex="客户确认" Width="80">
                                <Renderer Fn="changesate" />
                            </ext:Column>
                            <ext:CommandColumn ID="CommandColumn1" runat="server" Header="财务操作" Width="100">
                                <Commands>
                                    <ext:GridCommand Icon="Accept" CommandName="CwCheck" Text="财务确认">
                                    </ext:GridCommand>
                                </Commands>
                                <PrepareToolbar Fn="prepare" />
                                <Listeners>
                                    <Command Handler="CompanyX.CwCheck(record.data.店铺代码,record.data.结算日期);" />
                                </Listeners>
                            </ext:CommandColumn>
                        </Columns>
                    </ColumnModel>
                      <SelectionModel>
                        <ext:CheckboxSelectionModel ID="RowSelectionModel1" runat="server" />
                    </SelectionModel>
                    <View>
                        <ext:GridView>
                            <GetRowClass Fn="getRowClass" />
                        </ext:GridView>
                    </View>
                    <BottomBar>
                        <ext:PagingToolbar ID="PagingToolbar1" runat="server">
                            <Items>
                                <ext:Label ID="Label1" runat="server" Text="每页显示:" />
                                <ext:ToolbarSpacer ID="ToolbarSpacer1" runat="server" Width="10" />
                                <ext:ComboBox ID="ComboBox1" runat="server" Width="80">
                                    <Items>
                                        <ext:ListItem Text="10" />
                                        <ext:ListItem Text="20" />
                                        <ext:ListItem Text="50" />
                                        <ext:ListItem Text="100" />
                                    </Items>
                                    <SelectedItems>
                                        <ext:ListItem Value="50" />
                                    </SelectedItems>
                                    <Listeners>
                                        <Select Handler="#{GridPanel1}.store.pageSize = parseInt(this.getValue(), 10); #{GridPanel1}.store.reload();" />
                                    </Listeners>
                                </ext:ComboBox>
                                <ext:Button ID="Button2" runat="server" Text="导出Excel" Icon="PageExcel">
                                    <Listeners>
                                        <Click Handler="exportData('xls');" />
                                    </Listeners>
                                </ext:Button>
                            </Items>
                            <Plugins>
                                <ext:ProgressBarPager ID="ProgressBarPager1" runat="server" />
                            </Plugins>
                        </ext:PagingToolbar>
                    </BottomBar>
                </ext:GridPanel>
            </Items>
        </ext:Viewport>
    </div>
    </form>
</body>
</html>
